package com.qianguo.sender.usercenter;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.eva.androidlibrary.widget.mdedittext.MaterialEditText;
import com.qianguo.sender.R;
import com.qianguo.sender.base.BaseTitleActivity;

import org.androidannotations.annotations.Background;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

/**
 * 推荐附近商家
 *
 * @author eva
 * @date 16/5/16
 */
@EActivity(R.layout.activity_sender_recommend_shop)
public class SenderRecommendShopActivity extends BaseTitleActivity {

    @ViewById(R.id.sender_recommend_shop_name_edit_text)
    MaterialEditText mEdtShopName;

    @ViewById(R.id.sender_recommend_shop_address_edit_text)
    MaterialEditText mEdtShopAddress;

    public static void jumpToRecommend(Context context) {
        context.startActivity(new Intent(context, SenderRecommendShopActivity_.class));
    }

    @Click(R.id.sender_recommend_shop_submit_button)
    void clickSubmit() {
        String shopName = mEdtShopName.getText().toString();
        String shopAddress = mEdtShopAddress.getText().toString();
        if (TextUtils.isEmpty(shopName)) {
            mEdtShopName.setError(getString(R.string.sender_recommend_hint_shop_name));
            return;
        }

        if (TextUtils.isEmpty(shopAddress)) {
            mEdtShopAddress.setError(getString(R.string.sender_recommend_hint_shop_address));
            return;
        }

        recommendShop(shopName, shopAddress);
    }

    @Override
    protected String getToolbarTitle() {
        return getString(R.string.sender_recommend_shop_title);
    }

    @Override
    protected void initializeUI() {

    }

    @Background
    void recommendShop(String shopName, String shopAddress) {
        // TODO: 16/5/16 提交推荐商家
    }
}
